package setter;


import autowired.User;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @Author quan
 * @Description 将Service类注入到UseController类
 * @Date 2023/7/14 15:23
 */

/**
 * Setter方法注入
 */
@Controller
public class UserController {

    //关键
    private UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public void sayHi(){
        userService.doService();
        System.out.println("hi,userController");
    }
}
